# 生成测试报告
# 导包
import unittest
# 初始化套件
import HTMLTestRunner_PY3

from script.test_department import TestPart
from script.test_department_params import TestPartParams
from script.test_login import TestLogin

suite = unittest.TestSuite()
# 套件中添加测试用例
suite.addTest(unittest.makeSuite(TestLogin))
# 初始化runner
with open("./report/report.html", "wb") as f:
    # 执行测试用例生成测试报告
    runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
    runner.run(suite)

# 部门生成测试报告
suite1 = unittest.TestSuite()
suite1.addTest(unittest.makeSuite(TestPart))
with open("./report/depart_report.html", "wb") as d:
    runner = HTMLTestRunner_PY3.HTMLTestRunner(d)
    runner.run(suite1)

# 参数化部门架构的生成测试报告
suite2 = unittest.TestSuite()
suite2.addTest(unittest.makeSuite(TestPartParams))
with open("./report/depart_params_report.html", "wb") as c:
    runner = HTMLTestRunner_PY3.HTMLTestRunner(c)
    runner.run(suite2)